home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
PIELOGO.ARJ
/
PSGRAF.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-02
|
1KB
|
56 lines
/* Psgraf.c Copyright (c) 1992 Kevin Stokes, Pie in the Sky Software */
#include <stdio.h>
#include <math.h>
#include <malloc.h>
extern FILE *psfileptr;
void psinit(psnameptr)
char *psnameptr;
{
FILE *pshdrfile;
int c;
if(psnameptr != NULL) psfileptr = fopen(psnameptr,"w");
while (psfileptr == NULL) {
printf("\nEnter postscript output file name : ");
scanf("%s",psnameptr);
psfileptr = fopen(psnameptr,"w");
if(psfileptr == NULL) printf("\n Error opening file : %s\n",psnameptr);
}
pshdrfile = fopen("psheader","r");
if(pshdrfile == NULL) {printf("psheader file missing"); exit(0);}
while((c = getc(pshdrfile)) != EOF)
putc(c,psfileptr);
fclose(pshdrfile);
/* fprintf(psfileptr,"\nThis is a damn Postscript file\n"); */
}
void psclose()
{
FILE *pshdrfile;
int c;
/* fprintf(psfileptr,"\nThis is the end of the damn Postscript file\n"); */
pshdrfile = fopen("pstrailr","r");
if(pshdrfile == NULL) {printf("psheader file missing"); exit(0);}
while((c = getc(pshdrfile)) != EOF)
putc(c,psfileptr);
fclose(pshdrfile);
psfileptr = fclose(psfileptr);
}
int psscale(argu)
int argu;
{
return((int) ( (float) argu*5000./640.));
}
void psline(argx1,argy1,argx2,argy2)
int argx1,argy1,argx2,argy2;
{
fprintf(psfileptr,"%d %d M\n",psscale(640-argx1),psscale(argy1));
fprintf(psfileptr,"%d %d C\n",psscale(640-argx2),psscale(argy2));
fprintf(psfileptr,"stroke\n");
}